(echo -n "internal_styles.c: mkstyle.sh " ; echo style/*.style ; /bin/echo -e '\t./mkstyle.sh > internal_styles.c || (rm -f internal_styles.c ; exit 1)' ) >> /tmp/dep
echo Edit Makefile and bring in /tmp/dep
-VERSIONU=1_2_5_beta03272005-c
-VERSIOND=1.2.5_beta03272005-c
-VERSIONU=1_2_5
-VERSIOND=1.2.5
+VERSIONU=1_2_6-beta04122005-gsak
+VERSIOND=1.2.6_beta04122005-gsak
+# VERSIONU=1_2_5
+# VERSIOND=1.2.5
release:
cvs commit
if (global_opts.synthesize_shortnames && waypointp->description) {
if (waypointp->shortname)
xfree(waypointp->shortname);
- waypointp->shortname = mkshort(mkshort_wr_handle, waypointp->description);
+ waypointp->shortname = mkshort_from_wpt(mkshort_wr_handle, waypointp);
}
bh->wpt_name = waypointp->shortname;
bh ++;
if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
if (wpt->description) {
- if (global_opts.synthesize_shortnames)
- shortname = mkshort(xcsv_file.mkshort_handle, wpt->description);
+ if (global_opts.synthesize_shortnames)
+ shortname = mkshort_from_wpt(xcsv_file.mkshort_handle, wpt);
else
shortname = csv_stringclean(wpt->description, xcsv_file.badchars);
} else {
/*
- Copyright (C) 2002 Robert Lipe, robertlipe@usa.net
+ Copyright (C) 2002, 2003, 2004, 2005 Robert Lipe, robertlipe@usa.net
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define mkshort( a, b) MKSHORT(a,b,__FILE__, __LINE__)
#define mkshort_new_handle() MKSHORT_NEW_HANDLE(__FILE__,__LINE__)
#endif
+char *mkshort_from_wpt(void *h, const waypoint *wpt);
void mkshort_del_handle(void *h);
void setshort_length(void *, int n);
void setshort_badchars(void *, const char *);
fprintf(file_out, "%-8s %08.3f%c %09.3f%c %07.0f%c %-30.30s %s\n",
global_opts.synthesize_shortnames ?
- mkshort(mkshort_handle, wpt->description) :
+ mkshort_from_wpt(mkshort_handle, wpt) :
wpt->shortname,
fabs(lat),
lat < 0.0 ? 'S' : 'N',
static time_t file_time;
-static char *gsshortnames = NULL;
static char *snlen = NULL;
static char *suppresswhite = NULL;
static char *urlbase = NULL;
wpt_tmp = NULL;
break;
case tt_cache_name:
- if (gsshortnames) {
- if (wpt_tmp->notes)
- xfree(wpt_tmp->notes);
- wpt_tmp->notes = xstrdup(cdatastrp);
- }
+ wpt_tmp->notes = xstrdup(cdatastrp);
break;
case tt_cache_container:
wpt_tmp->gc_data.container = gs_mkcont(cdatastrp);
static
arglist_t gpx_args[] = {
- { "gsshortnames", &gsshortnames,
- "Prefer shorter descriptions from Groundspeak files",
- NULL, ARGTYPE_BOOL },
{ "snlen", &snlen, "Length of generated shortnames",
NULL, ARGTYPE_INT },
{ "suppresswhite", &suppresswhite,
fprintf(file_out, "<hr>\n");
fprintf(file_out, "<a name=\"%s\"></a><table width=\"100%%\"><tr><td>\n", wpt->shortname);
fprintf(file_out, "<h3 class=\"waypoint\">%s - %c%d°%06.3f %c%d°%06.3f (%ld%c %6.0f %7.0f)",
- (global_opts.synthesize_shortnames) ? mkshort(mkshort_handle, wpt->description) : wpt->shortname,
+ (global_opts.synthesize_shortnames) ? mkshort_from_wpt(mkshort_handle, wpt) : wpt->shortname,
wpt->latitude < 0 ? 'S' : 'N', latint, 60.0 * (fabs(wpt->latitude) - latint),
wpt->longitude < 0 ? 'W' : 'E', lonint, 60.0 * (fabs(wpt->longitude) - lonint),
utmz, utmzc, utme, utmn);
/* Try and make sure we have a name */
if ((! wpt->shortname) || global_opts.synthesize_shortnames) {
if (wpt->description && global_opts.synthesize_shortnames) {
- name = mkshort(mkshort_handle, wpt->description);
+ name = mkshort_from_wpt(mkshort_handle, wpt);
} else if (wpt->shortname) {
name = xstrdup(wpt->shortname);
} else if (wpt->description) {
char *vdata;
time_t tm_t;
const char *sn = global_opts.synthesize_shortnames ?
- mkshort(mkshort_handle, wpt->description) :
+ mkshort_from_wpt(mkshort_handle, wpt) :
wpt->shortname;
rec = xcalloc(sizeof(*rec)+56,1);
const char *icon_token=NULL;
char *owpt;
char *odesc;
- char *isrc;
+ char *isrc = NULL;
ilat = waypointp->latitude;
ilon = waypointp->longitude;
isrc = waypointp->notes ? waypointp->notes : waypointp->description;
owpt = global_opts.synthesize_shortnames ?
- mkshort(mkshort_handle, isrc) : waypointp->shortname;
+ mkshort_from_wpt(mkshort_handle, waypointp) : waypointp->shortname;
odesc = isrc ? isrc : "";
owpt = mag_cleanse(owpt);
static int cnt = 0;
const char *iconp = NULL;
const char *sn = global_opts.synthesize_shortnames ?
- mkshort(mkshort_handle, waypointp->description) :
+ mkshort_from_wpt(mkshort_handle, waypointp) :
waypointp->shortname;
char *tmp;
ostring = nstring;
}
- /*
- * Look at the back of the string for " by BLAH" and whack
- * it there.
- */
- nstring = xxstrdup(ostring, file, line);
- l = strlen (nstring);
- while (l > 0) {
- if (case_ignore_strncmp(&nstring[l], " by ",4) == 0) {
- nstring[l] = 0;
- break;
- }
- l --;
- }
- xfree(ostring);
- ostring = nstring;
-
/* Eliminate leading whitespace in all cases */
while (ostring[0] && isspace(ostring[0])) {
/* If orig string has N bytes, we want to copy N-1 bytes
return ostring;
}
+/*
+ * As above, but arg list is a waypoint so we can centralize
+ * the code that considers the alternate sources.
+ */
+char *
+mkshort_from_wpt(void *h, const waypoint *wpt)
+{
+ /* This probably came from a Groundspeak Pocket Query
+ * so use the 'cache name' instead of the description field
+ * which contains placer name, diff, terr, and generally way
+ * more stuff than should be in any one field...
+ */
+ if (wpt->gc_data.diff && wpt->gc_data.terr && wpt->notes) {
+ return mkshort(h, wpt->notes);
+ }
+
+ if (wpt->description) {
+ return mkshort(h, wpt->description);
+ }
+
+ if (wpt->notes) {
+ return mkshort(h, wpt->notes);
+ }
+}
+
+
#if 0
char *foo[] = {
"VwthPst# 3700.706N 08627.588W 0000000m View the Past #2 ",
if ((!wpt->shortname) || (global_opts.synthesize_shortnames)) {
if (wpt->description) {
if (global_opts.synthesize_shortnames)
- shortname = mkshort(mkshort_handle, wpt->description);
+ shortname = mkshort_from_wpt(mkshort_handle, wpt);
else
shortname = csv_stringclean(wpt->description, ",");
} else {
char bookmarktext[17];
if ( bmid ) {
- char * s = mkshort(mkshort_bookmark_handle, wpt->description);
+ char * s = mkshort_from_wpt(mkshort_bookmark_handle, wpt);
sprintf( bookmarktext, "%6s:%9s",
wpt->shortname?wpt->shortname:"",s);
xfree(s);
}
else {
- char * s = mkshort(mkshort_bookmark_handle, wpt->description);
+ char * s = mkshort_from_wpt(mkshort_bookmark_handle, wpt);
sprintf( bookmarktext, "%16s", s);
xfree(s);
}
strftime(tbuf, sizeof(tbuf), "%d-%b-%Y", localtime(&tm));
docprintf(300, "%-16s %c%d %06.3f %c%d %06.3f (%ld%c %6.0f %7.0f)",
- (global_opts.synthesize_shortnames) ? mkshort(mkshort_handle, wpt->description) : wpt->shortname,
+ (global_opts.synthesize_shortnames) ? mkshort_from_wpt(mkshort_handle, wpt) : wpt->shortname,
wpt->latitude < 0 ? 'S' : 'N', abs(latint), 60.0 * (fabs(wpt->latitude) - latint),
wpt->longitude < 0 ? 'W' : 'E', abs(lonint), 60.0 * (fabs(wpt->longitude) - lonint),
utmz, utmzc, utme, utmn);
fprintf(file_out, "W %-6.6s %c%08.5f %c%011.5f %s %5d %-40.40s %5e %d\n",
global_opts.synthesize_shortnames ?
- mkshort(mkshort_handle, wpt->description) :
+ mkshort_from_wpt(mkshort_handle, wpt) :
wpt->shortname,
lat < 0.0 ? 'S' : 'N',
fabs(lat),
if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
if (wpt->description) {
if (global_opts.synthesize_shortnames)
- shortname = mkshort(mkshort_handle, wpt->description);
+ shortname = mkshort_from_wpt(mkshort_handle, wpt);
else
shortname = xstrdup(wpt->description);
} else {
strftime(tbuf, sizeof(tbuf), "%d-%b-%Y", localtime(&tm));
fprintf(file_out, "%-16s %c%d %06.3f %c%d %06.3f (%ld%c %6.0f %7.0f)",
- (global_opts.synthesize_shortnames) ? mkshort(mkshort_handle, wpt->description) : wpt->shortname,
+ (global_opts.synthesize_shortnames) ? mkshort_from_wpt(mkshort_handle, wpt) : wpt->shortname,
wpt->latitude < 0 ? 'S' : 'N', abs(latint), 60.0 * (fabs(wpt->latitude) - latint),
wpt->longitude < 0 ? 'W' : 'E', abs(lonint), 60.0 * (fabs(wpt->longitude) - lonint),
utmz, utmzc, utme, utmn);
if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
if (wpt->description) {
if (global_opts.synthesize_shortnames)
- shortname = mkshort(mkshort_handle, wpt->description);
+ shortname = mkshort_from_wpt(mkshort_handle, wpt);
else
shortname = csv_stringclean(wpt->description, ",\"");
} else {
if ((! wpt->shortname) || (global_opts.synthesize_shortnames)) {
if (wpt->description) {
if (global_opts.synthesize_shortnames)
- shortname = mkshort(mkshort_handle, wpt->description);
+ shortname = mkshort_from_wpt(mkshort_handle, wpt);
else
shortname = xstrdup(wpt->description);
} else {